import { useReactive } from "ahooks";
import { useModel } from "umi";
import { useEffect } from "react";
import compress from "gql-compress";

const useAllMerchants = () => {
    const { graphqlFetch } = useModel("global");

    const state = useReactive({
        merchantsLoading: false,
        merchants: [],
    });

    const loadAllMerchants = async () => {
        state.merchantsLoading = true;
        // let res = await graphqlFetch({
        //     query,
        //     variables: {},
        // });
        // let merchants = res?.a?.nodes || [];
        let merchants = [0, 1, 3, 3, 3, 3, 3]
        state.merchants = merchants;
        state.merchantsLoading = false;
        // return merchants;
    };

    return { ...state, loadAllMerchants };
};


const query = compress(``);

export default useAllMerchants;
